package com.ndp.fb.walle.controller;

import com.ndp.fb.rdb.model.Page;
import com.ndp.fb.rdb.model.User;
import com.ndp.fb.walle.business.PageService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * 创建广告
 * Created by hermen.he on 2016/4/28.
 */
@RequestMapping("/createAd")
@Controller
public class CreateAdController {

    private final Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private PageService pageService;


    @RequestMapping(value = "getAllApps")
    @ResponseBody
    public List<Page> getPagesByUserId(HttpServletRequest request) {
        User user = (User) request.getSession().getAttribute("user");
        return pageService.getPagesByUserId(user.getTicket());
    }
}
